package com.dm.cloud.images.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtil {

    /**
     * 替换到ANSI
     * @param input
     * @return
     */
    public static String replaceANSI(String input){
        Pattern pattern = Pattern.compile("\\u001B\\[\\d+(;\\d+)*m"); // 定义匹配模式
        Matcher matcher = pattern.matcher(input);

        while (matcher.find()) {
            input = input.replaceAll(Pattern.quote(matcher.group()), ""); // 将匹配到的部分替换为空字符串
        }
        return input;
    }

}
